package com.p595263720.o_amap.search.model;


import com.amap.api.maps.model.LatLng;
import com.amap.api.services.core.PoiItem;
import com.amap.api.services.poisearch.IndoorData;
import com.amap.api.services.poisearch.Photo;
import com.amap.api.services.poisearch.PoiItemExtension;
import com.amap.api.services.poisearch.SubPoiItem;

import java.util.ArrayList;
import java.util.List;

public class UnifiedPoiItem {
    String businessArea;
    String adName;
    String cityName;
    String provinceName;
    String typeDes;
    String tel;
    String adCode;
    String poiId;
    int distance;
    String title;
    String snippet;
    LatLng latLonPoint;
    String cityCode;
    LatLng enter;
    LatLng exit;
    String website;
    String postcode;
    String email;
    String direction;
    boolean isIndoorMap;
    String provinceCode;
    String parkingType;
    List<UnifiedSubPoiItem> subPois = new ArrayList<UnifiedSubPoiItem>();
    UnifiedIndoorData indoorData;
    List<UnifiedPhoto> photos = new ArrayList<UnifiedPhoto>();
    UnifiedPoiItemExtension poiExtension;
    String typeCode;
    String shopID;

    public UnifiedPoiItem(PoiItem poiItem) {
        this.businessArea = poiItem.getBusinessArea();
        this.adName = poiItem.getAdName();
        this.cityName = poiItem.getCityName();
        this.provinceName = poiItem.getProvinceName();
        this.typeDes = poiItem.getTypeDes();
        this.tel = poiItem.getTel();
        this.adCode = poiItem.getAdCode();
        this.poiId = poiItem.getPoiId();
        this.distance = poiItem.getDistance();
        this.title = poiItem.getTitle();
        this.snippet = poiItem.getSnippet();
        this.latLonPoint = UnifiedSearchBound.toLatLng(poiItem.getLatLonPoint());
        this.cityCode = poiItem.getCityCode();
        this.enter = UnifiedSearchBound.toLatLng(poiItem.getEnter());
        this.exit = UnifiedSearchBound.toLatLng(poiItem.getExit());
        this.website = poiItem.getWebsite();
        this.postcode = poiItem.getPostcode();
        this.email = poiItem.getEmail();
        this.direction = poiItem.getDirection();
        this.isIndoorMap = poiItem.isIndoorMap();
        this.provinceCode = poiItem.getProvinceCode();
        this.parkingType = poiItem.getParkingType();
        this.typeCode = poiItem.getTypeCode();
        this.shopID = poiItem.getShopID();
        List<SubPoiItem> subPoiItems = poiItem.getSubPois();
        if (subPoiItems != null) {
            for (SubPoiItem subPoiItem : subPoiItems) {
                subPois.add(new UnifiedSubPoiItem(subPoiItem));
            }
        }
        IndoorData in = poiItem.getIndoorData();
        indoorData = new UnifiedIndoorData(in);
        List<Photo> poList = poiItem.getPhotos();
        if (poList != null) {
            for (Photo photo : poList) {
                photos.add(new UnifiedPhoto(photo));
            }
        }
        PoiItemExtension poiItemExtension = poiItem.getPoiExtension();
        poiExtension = new UnifiedPoiItemExtension(poiItemExtension);
    }
}
